home *** CD-ROM | disk | FTP | other *** search
/ TeX 1995 July / TeX CD-ROM July 1995 (Disc 1)(Walnut Creek)(1995).ISO / biblio / bibtex / contrib / plainyr.bst < prev    next >
Text File  |  1992-07-19  |  22KB  |  1,145 lines

  1. %% /usr/local/lib/tex/bibtex/plainyr.bst, Mon Jun 29 08:06:48 1992
  2. %% Edit by Nelson H. F. Beebe <beebe@plot79.math.utah.edu>
  3. %% I've called this posting plainyr instead of the author's datasort
  4. %% because the latter is uninformative.
  5.  
  6. % Newsgroups: comp.text.tex
  7. % Path: math.utah.edu!hellgate.utah.edu!cs.utexas.edu!uunet!brunix!cs.brown.edu!mpp
  8. % From: mpp@cns.brown.edu (Michael P. Perrone)
  9. % Subject: Re: bibtex sorting by year
  10. % Message-ID: <1992Jun26.075302.21206@cs.brown.edu>
  11. % Sender: mpp@cs.brown.edu (Michael P. Perrone)
  12. % Organization: Center for Neural Science, Brown University
  13. % References:  <1992Jun26.065942.20721@cs.brown.edu>
  14. % Date: Fri, 26 Jun 1992 07:53:02 GMT
  15. % Lines: 1128
  16. %
  17. % i figured out the bibtex problem.
  18. % the following bibstyle file will sort by year, author, title (in that order)
  19. % with the usual editor, organization (etc.) substitutions
  20. %
  21. % % ----- cut here -------------------------------
  22. %
  23. %-------------------------------------------------------------------------
  24. % DATASORT.BST --- created: 92.6.26 (Michael P. Perrone, Brown University)
  25. %
  26. % this is a simple hack of the plain.bst bibtex style file
  27. % which processes bibliography entries in chronological order
  28. % by year.  within a year things are sort by author, title, etc.
  29. %
  30. % DISCLAIMER:  if this doesn't work - sorry!
  31. %-------------------------------------------------------------------------
  32. %
  33. %
  34. % [MODIFIED] BibTeX standard bibliography style `plain'
  35.         % version 0.99a for BibTeX versions 0.99a or later, LaTeX version 2.09.
  36.         % Copyright (C) 1985, all rights reserved.
  37.         % Copying of this file is authorized only if either
  38.         % (1) you make absolutely no changes to your copy, including name, or
  39.         % (2) if you do make changes, you name it something other than
  40.         % btxbst.doc, plain.bst, unsrt.bst, alpha.bst, and abbrv.bst.
  41.         % This restriction helps ensure that all standard styles are identical.
  42.         % The file btxbst.doc has the documentation for this style.
  43.  
  44. ENTRY
  45.   { address
  46.     author
  47.     booktitle
  48.     chapter
  49.     edition
  50.     editor
  51.     howpublished
  52.     institution
  53.     journal
  54.     key
  55.     month
  56.     note
  57.     number
  58.     organization
  59.     pages
  60.     publisher
  61.     school
  62.     series
  63.     title
  64.     type
  65.     volume
  66.     year
  67.   }
  68.   {}
  69.   { label }
  70.  
  71. INTEGERS { output.state before.all mid.sentence after.sentence after.block }
  72.  
  73. FUNCTION {init.state.consts}
  74. { #0 'before.all :=
  75.   #1 'mid.sentence :=
  76.   #2 'after.sentence :=
  77.   #3 'after.block :=
  78. }
  79.  
  80. STRINGS { s t }
  81.  
  82. FUNCTION {output.nonnull}
  83. { 's :=
  84.   output.state mid.sentence =
  85.     { ", " * write$ }
  86.     { output.state after.block =
  87.         { add.period$ write$
  88.           newline$
  89.           "\newblock " write$
  90.         }
  91.         { output.state before.all =
  92.             'write$
  93.             { add.period$ " " * write$ }
  94.           if$
  95.         }
  96.       if$
  97.       mid.sentence 'output.state :=
  98.     }
  99.   if$
  100.   s
  101. }
  102.  
  103. FUNCTION {output}
  104. { duplicate$ empty$
  105.     'pop$
  106.     'output.nonnull
  107.   if$
  108. }
  109.  
  110. FUNCTION {output.check}
  111. { 't :=
  112.   duplicate$ empty$
  113.     { pop$ "empty " t * " in " * cite$ * warning$ }
  114.     'output.nonnull
  115.   if$
  116. }
  117.  
  118. FUNCTION {output.bibitem}
  119. { newline$
  120.   "\bibitem{" write$
  121.   cite$ write$
  122.   "}" write$
  123.   newline$
  124.   ""
  125.   before.all 'output.state :=
  126. }
  127.  
  128. FUNCTION {fin.entry}
  129. { add.period$
  130.   write$
  131.   newline$
  132. }
  133.  
  134. FUNCTION {new.block}
  135. { output.state before.all =
  136.     'skip$
  137.     { after.block 'output.state := }
  138.   if$
  139. }
  140.  
  141. FUNCTION {new.sentence}
  142. { output.state after.block =
  143.     'skip$
  144.     { output.state before.all =
  145.         'skip$
  146.         { after.sentence 'output.state := }
  147.       if$
  148.     }
  149.   if$
  150. }
  151.  
  152. FUNCTION {not}
  153. {   { #0 }
  154.     { #1 }
  155.   if$
  156. }
  157.  
  158. FUNCTION {and}
  159. {   'skip$
  160.     { pop$ #0 }
  161.   if$
  162. }
  163.  
  164. FUNCTION {or}
  165. {   { pop$ #1 }
  166.     'skip$
  167.   if$
  168. }
  169.  
  170. FUNCTION {new.block.checka}
  171. { empty$
  172.     'skip$
  173.     'new.block
  174.   if$
  175. }
  176.  
  177. FUNCTION {new.block.checkb}
  178. { empty$
  179.   swap$ empty$
  180.   and
  181.     'skip$
  182.     'new.block
  183.   if$
  184. }
  185.  
  186. FUNCTION {new.sentence.checka}
  187. { empty$
  188.     'skip$
  189.     'new.sentence
  190.   if$
  191. }
  192.  
  193. FUNCTION {new.sentence.checkb}
  194. { empty$
  195.   swap$ empty$
  196.   and
  197.     'skip$
  198.     'new.sentence
  199.   if$
  200. }
  201.  
  202. FUNCTION {field.or.null}
  203. { duplicate$ empty$
  204.     { pop$ "" }
  205.     'skip$
  206.   if$
  207. }
  208.  
  209. FUNCTION {emphasize}
  210. { duplicate$ empty$
  211.     { pop$ "" }
  212.     { "{\em " swap$ * "}" * }
  213.   if$
  214. }
  215.  
  216. INTEGERS { nameptr namesleft numnames }
  217.  
  218. FUNCTION {format.names}
  219. { 's :=
  220.   #1 'nameptr :=
  221.   s num.names$ 'numnames :=
  222.   numnames 'namesleft :=
  223.     { namesleft #0 > }
  224.     { s nameptr "{ff~}{vv~}{ll}{, jj}" format.name$ 't :=
  225.       nameptr #1 >
  226.         { namesleft #1 >
  227.             { ", " * t * }
  228.             { numnames #2 >
  229.                 { "," * }
  230.                 'skip$
  231.               if$
  232.               t "others" =
  233.                 { " et~al." * }
  234.                 { " and " * t * }
  235.               if$
  236.             }
  237.           if$
  238.         }
  239.         't
  240.       if$
  241.       nameptr #1 + 'nameptr :=
  242.       namesleft #1 - 'namesleft :=
  243.     }
  244.   while$
  245. }
  246.  
  247. FUNCTION {format.authors}
  248. { author empty$
  249.     { "" }
  250.     { author format.names }
  251.   if$
  252. }
  253.  
  254. FUNCTION {format.editors}
  255. { editor empty$
  256.     { "" }
  257.     { editor format.names
  258.       editor num.names$ #1 >
  259.         { ", editors" * }
  260.         { ", editor" * }
  261.       if$
  262.     }
  263.   if$
  264. }
  265.  
  266. FUNCTION {format.title}
  267. { title empty$
  268.     { "" }
  269.     { title "t" change.case$ }
  270.   if$
  271. }
  272.  
  273. FUNCTION {n.dashify}
  274. { 't :=
  275.   ""
  276.     { t empty$ not }
  277.     { t #1 #1 substring$ "-" =
  278.         { t #1 #2 substring$ "--" = not
  279.             { "--" *
  280.               t #2 global.max$ substring$ 't :=
  281.             }
  282.             {   { t #1 #1 substring$ "-" = }
  283.                 { "-" *
  284.                   t #2 global.max$ substring$ 't :=
  285.                 }
  286.               while$
  287.             }
  288.           if$
  289.         }
  290.         { t #1 #1 substring$ *
  291.           t #2 global.max$ substring$ 't :=
  292.         }
  293.       if$
  294.     }
  295.   while$
  296. }
  297.  
  298. FUNCTION {format.date}
  299. { year empty$
  300.     { month empty$
  301.         { "" }
  302.         { "there's a month but no year in " cite$ * warning$
  303.           month
  304.         }
  305.       if$
  306.     }
  307.     { month empty$
  308.         'year
  309.         { month " " * year * }
  310.       if$
  311.     }
  312.   if$
  313. }
  314.  
  315. FUNCTION {format.btitle}
  316. { title emphasize
  317. }
  318.  
  319. FUNCTION {tie.or.space.connect}
  320. { duplicate$ text.length$ #3 <
  321.     { "~" }
  322.     { " " }
  323.   if$
  324.   swap$ * *
  325. }
  326.  
  327. FUNCTION {either.or.check}
  328. { empty$
  329.     'pop$
  330.     { "can't use both " swap$ * " fields in " * cite$ * warning$ }
  331.   if$
  332. }
  333.  
  334. FUNCTION {format.bvolume}
  335. { volume empty$
  336.     { "" }
  337.     { "volume" volume tie.or.space.connect
  338.       series empty$
  339.         'skip$
  340.         { " of " * series emphasize * }
  341.       if$
  342.       "volume and number" number either.or.check
  343.     }
  344.   if$
  345. }
  346.  
  347. FUNCTION {format.number.series}
  348. { volume empty$
  349.     { number empty$
  350.         { series field.or.null }
  351.         { output.state mid.sentence =
  352.             { "number" }
  353.             { "Number" }
  354.           if$
  355.           number tie.or.space.connect
  356.           series empty$
  357.             { "there's a number but no series in " cite$ * warning$ }
  358.             { " in " * series * }
  359.           if$
  360.         }
  361.       if$
  362.     }
  363.     { "" }
  364.   if$
  365. }
  366.  
  367. FUNCTION {format.edition}
  368. { edition empty$
  369.     { "" }
  370.     { output.state mid.sentence =
  371.         { edition "l" change.case$ " edition" * }
  372.         { edition "t" change.case$ " edition" * }
  373.       if$
  374.     }
  375.   if$
  376. }
  377.  
  378. INTEGERS { multiresult }
  379.  
  380. FUNCTION {multi.page.check}
  381. { 't :=
  382.   #0 'multiresult :=
  383.     { multiresult not
  384.       t empty$ not
  385.       and
  386.     }
  387.     { t #1 #1 substring$
  388.       duplicate$ "-" =
  389.       swap$ duplicate$ "," =
  390.       swap$ "+" =
  391.       or or
  392.         { #1 'multiresult := }
  393.         { t #2 global.max$ substring$ 't := }
  394.       if$
  395.     }
  396.   while$
  397.   multiresult
  398. }
  399.  
  400. FUNCTION {format.pages}
  401. { pages empty$
  402.     { "" }
  403.     { pages multi.page.check
  404.         { "pages" pages n.dashify tie.or.space.connect }
  405.         { "page" pages tie.or.space.connect }
  406.       if$
  407.     }
  408.   if$
  409. }
  410.  
  411. FUNCTION {format.vol.num.pages}
  412. { volume field.or.null
  413.   number empty$
  414.     'skip$
  415.     { "(" number * ")" * *
  416.       volume empty$
  417.         { "there's a number but no volume in " cite$ * warning$ }
  418.         'skip$
  419.       if$
  420.     }
  421.   if$
  422.   pages empty$
  423.     'skip$
  424.     { duplicate$ empty$
  425.         { pop$ format.pages }
  426.         { ":" * pages n.dashify * }
  427.       if$
  428.     }
  429.   if$
  430. }
  431.  
  432. FUNCTION {format.chapter.pages}
  433. { chapter empty$
  434.     'format.pages
  435.     { type empty$
  436.         { "chapter" }
  437.         { type "l" change.case$ }
  438.       if$
  439.       chapter tie.or.space.connect
  440.       pages empty$
  441.         'skip$
  442.         { ", " * format.pages * }
  443.       if$
  444.     }
  445.   if$
  446. }
  447.  
  448. FUNCTION {format.in.ed.booktitle}
  449. { booktitle empty$
  450.     { "" }
  451.     { editor empty$
  452.         { "In " booktitle emphasize * }
  453.         { "In " format.editors * ", " * booktitle emphasize * }
  454.       if$
  455.     }
  456.   if$
  457. }
  458.  
  459. FUNCTION {empty.misc.check}
  460. { author empty$ title empty$ howpublished empty$
  461.   month empty$ year empty$ note empty$
  462.   and and and and and
  463.   key empty$ not and
  464.     { "all relevant fields are empty in " cite$ * warning$ }
  465.     'skip$
  466.   if$
  467. }
  468.  
  469. FUNCTION {format.thesis.type}
  470. { type empty$
  471.     'skip$
  472.     { pop$
  473.       type "t" change.case$
  474.     }
  475.   if$
  476. }
  477.  
  478. FUNCTION {format.tr.number}
  479. { type empty$
  480.     { "Technical Report" }
  481.     'type
  482.   if$
  483.   number empty$
  484.     { "t" change.case$ }
  485.     { number tie.or.space.connect }
  486.   if$
  487. }
  488.  
  489. FUNCTION {format.article.crossref}
  490. { key empty$
  491.     { journal empty$
  492.         { "need key or journal for " cite$ * " to crossref " * crossref *
  493.           warning$
  494.           ""
  495.         }
  496.         { "In {\em " journal * "\/}" * }
  497.       if$
  498.     }
  499.     { "In " key * }
  500.   if$
  501.   " \cite{" * crossref * "}" *
  502. }
  503.  
  504. FUNCTION {format.crossref.editor}
  505. { editor #1 "{vv~}{ll}" format.name$
  506.   editor num.names$ duplicate$
  507.   #2 >
  508.     { pop$ " et~al." * }
  509.     { #2 <
  510.         'skip$
  511.         { editor #2 "{ff }{vv }{ll}{ jj}" format.name$ "others" =
  512.             { " et~al." * }
  513.             { " and " * editor #2 "{vv~}{ll}" format.name$ * }
  514.           if$
  515.         }
  516.       if$
  517.     }
  518.   if$
  519. }
  520.  
  521. FUNCTION {format.book.crossref}
  522. { volume empty$
  523.     { "empty volume in " cite$ * "'s crossref of " * crossref * warning$
  524.       "In "
  525.     }
  526.     { "Volume" volume tie.or.space.connect
  527.       " of " *
  528.     }
  529.   if$
  530.   editor empty$
  531.   editor field.or.null author field.or.null =
  532.   or
  533.     { key empty$
  534.         { series empty$
  535.             { "need editor, key, or series for " cite$ * " to crossref " *
  536.               crossref * warning$
  537.               "" *
  538.             }
  539.             { "{\em " * series * "\/}" * }
  540.           if$
  541.         }
  542.         { key * }
  543.       if$
  544.     }
  545.     { format.crossref.editor * }
  546.   if$
  547.   " \cite{" * crossref * "}" *
  548. }
  549.  
  550. FUNCTION {format.incoll.inproc.crossref}
  551. { editor empty$
  552.   editor field.or.null author field.or.null =
  553.   or
  554.     { key empty$
  555.         { booktitle empty$
  556.             { "need editor, key, or booktitle for " cite$ * " to crossref " *
  557.               crossref * warning$
  558.               ""
  559.             }
  560.             { "In {\em " booktitle * "\/}" * }
  561.           if$
  562.         }
  563.         { "In " key * }
  564.       if$
  565.     }
  566.     { "In " format.crossref.editor * }
  567.   if$
  568.   " \cite{" * crossref * "}" *
  569. }
  570.  
  571. FUNCTION {article}
  572. { output.bibitem
  573.   format.authors "author" output.check
  574.   new.block
  575.   format.title "title" output.check
  576.   new.block
  577.   crossref missing$
  578.     { journal emphasize "journal" output.check
  579.       format.vol.num.pages output
  580.       format.date "year" output.check
  581.     }
  582.     { format.article.crossref output.nonnull
  583.       format.pages output
  584.     }
  585.   if$
  586.   new.block
  587.   note output
  588.   fin.entry
  589. }
  590.  
  591. FUNCTION {book}
  592. { output.bibitem
  593.   author empty$
  594.     { format.editors "author and editor" output.check }
  595.     { format.authors output.nonnull
  596.       crossref missing$
  597.         { "author and editor" editor either.or.check }
  598.         'skip$
  599.       if$
  600.     }
  601.   if$
  602.   new.block
  603.   format.btitle "title" output.check
  604.   crossref missing$
  605.     { format.bvolume output
  606.       new.block
  607.       format.number.series output
  608.       new.sentence
  609.       publisher "publisher" output.check
  610.       address output
  611.     }
  612.     { new.block
  613.       format.book.crossref output.nonnull
  614.     }
  615.   if$
  616.   format.edition output
  617.   format.date "year" output.check
  618.   new.block
  619.   note output
  620.   fin.entry
  621. }
  622.  
  623. FUNCTION {booklet}
  624. { output.bibitem
  625.   format.authors output
  626.   new.block
  627.   format.title "title" output.check
  628.   howpublished address new.block.checkb
  629.   howpublished output
  630.   address output
  631.   format.date output
  632.   new.block
  633.   note output
  634.   fin.entry
  635. }
  636.  
  637. FUNCTION {inbook}
  638. { output.bibitem
  639.   author empty$
  640.     { format.editors "author and editor" output.check }
  641.     { format.authors output.nonnull
  642.       crossref missing$
  643.         { "author and editor" editor either.or.check }
  644.         'skip$
  645.       if$
  646.     }
  647.   if$
  648.   new.block
  649.   format.btitle "title" output.check
  650.   crossref missing$
  651.     { format.bvolume output
  652.       format.chapter.pages "chapter and pages" output.check
  653.       new.block
  654.       format.number.series output
  655.       new.sentence
  656.       publisher "publisher" output.check
  657.       address output
  658.     }
  659.     { format.chapter.pages "chapter and pages" output.check
  660.       new.block
  661.       format.book.crossref output.nonnull
  662.     }
  663.   if$
  664.   format.edition output
  665.   format.date "year" output.check
  666.   new.block
  667.   note output
  668.   fin.entry
  669. }
  670.  
  671. FUNCTION {incollection}
  672. { output.bibitem
  673.   format.authors "author" output.check
  674.   new.block
  675.   format.title "title" output.check
  676.   new.block
  677.   crossref missing$
  678.     { format.in.ed.booktitle "booktitle" output.check
  679.       format.bvolume output
  680.       format.number.series output
  681.       format.chapter.pages output
  682.       new.sentence
  683.       publisher "publisher" output.check
  684.       address output
  685.       format.edition output
  686.       format.date "year" output.check
  687.     }
  688.     { format.incoll.inproc.crossref output.nonnull
  689.       format.chapter.pages output
  690.     }
  691.   if$
  692.   new.block
  693.   note output
  694.   fin.entry
  695. }
  696.  
  697. FUNCTION {inproceedings}
  698. { output.bibitem
  699.   format.authors "author" output.check
  700.   new.block
  701.   format.title "title" output.check
  702.   new.block
  703.   crossref missing$
  704.     { format.in.ed.booktitle "booktitle" output.check
  705.       format.bvolume output
  706.       format.number.series output
  707.       format.pages output
  708.       address empty$
  709.         { organization publisher new.sentence.checkb
  710.           organization output
  711.           publisher output
  712.           format.date "year" output.check
  713.         }
  714.         { address output.nonnull
  715.           format.date "year" output.check
  716.           new.sentence
  717.           organization output
  718.           publisher output
  719.         }
  720.       if$
  721.     }
  722.     { format.incoll.inproc.crossref output.nonnull
  723.       format.pages output
  724.     }
  725.   if$
  726.   new.block
  727.   note output
  728.   fin.entry
  729. }
  730.  
  731. FUNCTION {conference} { inproceedings }
  732.  
  733. FUNCTION {manual}
  734. { output.bibitem
  735.   author empty$
  736.     { organization empty$
  737.         'skip$
  738.         { organization output.nonnull
  739.           address output
  740.         }
  741.       if$
  742.     }
  743.     { format.authors output.nonnull }
  744.   if$
  745.   new.block
  746.   format.btitle "title" output.check
  747.   author empty$
  748.     { organization empty$
  749.         { address new.block.checka
  750.           address output
  751.         }
  752.         'skip$
  753.       if$
  754.     }
  755.     { organization address new.block.checkb
  756.       organization output
  757.       address output
  758.     }
  759.   if$
  760.   format.edition output
  761.   format.date output
  762.   new.block
  763.   note output
  764.   fin.entry
  765. }
  766.  
  767. FUNCTION {mastersthesis}
  768. { output.bibitem
  769.   format.authors "author" output.check
  770.   new.block
  771.   format.title "title" output.check
  772.   new.block
  773.   "Master's thesis" format.thesis.type output.nonnull
  774.   school "school" output.check
  775.   address output
  776.   format.date "year" output.check
  777.   new.block
  778.   note output
  779.   fin.entry
  780. }
  781.  
  782. FUNCTION {misc}
  783. { output.bibitem
  784.   format.authors output
  785.   title howpublished new.block.checkb
  786.   format.title output
  787.   howpublished new.block.checka
  788.   howpublished output
  789.   format.date output
  790.   new.block
  791.   note output
  792.   fin.entry
  793.   empty.misc.check
  794. }
  795.  
  796. FUNCTION {phdthesis}
  797. { output.bibitem
  798.   format.authors "author" output.check
  799.   new.block
  800.   format.btitle "title" output.check
  801.   new.block
  802.   "PhD thesis" format.thesis.type output.nonnull
  803.   school "school" output.check
  804.   address output
  805.   format.date "year" output.check
  806.   new.block
  807.   note output
  808.   fin.entry
  809. }
  810.  
  811. FUNCTION {proceedings}
  812. { output.bibitem
  813.   editor empty$
  814.     { organization output }
  815.     { format.editors output.nonnull }
  816.   if$
  817.   new.block
  818.   format.btitle "title" output.check
  819.   format.bvolume output
  820.   format.number.series output
  821.   address empty$
  822.     { editor empty$
  823.         { publisher new.sentence.checka }
  824.         { organization publisher new.sentence.checkb
  825.           organization output
  826.         }
  827.       if$
  828.       publisher output
  829.       format.date "year" output.check
  830.     }
  831.     { address output.nonnull
  832.       format.date "year" output.check
  833.       new.sentence
  834.       editor empty$
  835.         'skip$
  836.         { organization output }
  837.       if$
  838.       publisher output
  839.     }
  840.   if$
  841.   new.block
  842.   note output
  843.   fin.entry
  844. }
  845.  
  846. FUNCTION {techreport}
  847. { output.bibitem
  848.   format.authors "author" output.check
  849.   new.block
  850.   format.title "title" output.check
  851.   new.block
  852.   format.tr.number output.nonnull
  853.   institution "institution" output.check
  854.   address output
  855.   format.date "year" output.check
  856.   new.block
  857.   note output
  858.   fin.entry
  859. }
  860.  
  861. FUNCTION {unpublished}
  862. { output.bibitem
  863.   format.authors "author" output.check
  864.   new.block
  865.   format.title "title" output.check
  866.   new.block
  867.   note "note" output.check
  868.   format.date output
  869.   fin.entry
  870. }
  871.  
  872. FUNCTION {default.type} { misc }
  873.  
  874. MACRO {jan} {"January"}
  875.  
  876. MACRO {feb} {"February"}
  877.  
  878. MACRO {mar} {"March"}
  879.  
  880. MACRO {apr} {"April"}
  881.  
  882. MACRO {may} {"May"}
  883.  
  884. MACRO {jun} {"June"}
  885.  
  886. MACRO {jul} {"July"}
  887.  
  888. MACRO {aug} {"August"}
  889.  
  890. MACRO {sep} {"September"}
  891.  
  892. MACRO {oct} {"October"}
  893.  
  894. MACRO {nov} {"November"}
  895.  
  896. MACRO {dec} {"December"}
  897.  
  898. MACRO {acmcs} {"ACM Computing Surveys"}
  899.  
  900. MACRO {acta} {"Acta Informatica"}
  901.  
  902. MACRO {cacm} {"Communications of the ACM"}
  903.  
  904. MACRO {ibmjrd} {"IBM Journal of Research and Development"}
  905.  
  906. MACRO {ibmsj} {"IBM Systems Journal"}
  907.  
  908. MACRO {ieeese} {"IEEE Transactions on Software Engineering"}
  909.  
  910. MACRO {ieeetc} {"IEEE Transactions on Computers"}
  911.  
  912. MACRO {ieeetcad}
  913.  {"IEEE Transactions on Computer-Aided Design of Integrated Circuits"}
  914.  
  915. MACRO {ipl} {"Information Processing Letters"}
  916.  
  917. MACRO {jacm} {"Journal of the ACM"}
  918.  
  919. MACRO {jcss} {"Journal of Computer and System Sciences"}
  920.  
  921. MACRO {scp} {"Science of Computer Programming"}
  922.  
  923. MACRO {sicomp} {"SIAM Journal on Computing"}
  924.  
  925. MACRO {tocs} {"ACM Transactions on Computer Systems"}
  926.  
  927. MACRO {tods} {"ACM Transactions on Database Systems"}
  928.  
  929. MACRO {tog} {"ACM Transactions on Graphics"}
  930.  
  931. MACRO {toms} {"ACM Transactions on Mathematical Software"}
  932.  
  933. MACRO {toois} {"ACM Transactions on Office Information Systems"}
  934.  
  935. MACRO {toplas} {"ACM Transactions on Programming Languages and Systems"}
  936.  
  937. MACRO {tcs} {"Theoretical Computer Science"}
  938.  
  939. READ
  940.  
  941. FUNCTION {sortify}
  942. { purify$
  943.   "l" change.case$
  944. }
  945.  
  946. INTEGERS { len }
  947.  
  948. FUNCTION {chop.word}
  949. { 's :=
  950.   'len :=
  951.   s #1 len substring$ =
  952.     { s len #1 + global.max$ substring$ }
  953.     's
  954.   if$
  955. }
  956.  
  957. FUNCTION {sort.format.names}
  958. { 's :=
  959.   #1 'nameptr :=
  960.   ""
  961.   s num.names$ 'numnames :=
  962.   numnames 'namesleft :=
  963.     { namesleft #0 > }
  964.     { nameptr #1 >
  965.         { "   " * }
  966.         'skip$
  967.       if$
  968.       s nameptr "{vv{ } }{ll{ }}{  ff{ }}{  jj{ }}" format.name$ 't :=
  969.       nameptr numnames = t "others" = and
  970.         { "et al" * }
  971.         { t sortify * }
  972.       if$
  973.       nameptr #1 + 'nameptr :=
  974.       namesleft #1 - 'namesleft :=
  975.     }
  976.   while$
  977. }
  978.  
  979. FUNCTION {sort.format.title}
  980. { 't :=
  981.   "A " #2
  982.     "An " #3
  983.       "The " #4 t chop.word
  984.     chop.word
  985.   chop.word
  986.   sortify
  987.   #1 global.max$ substring$
  988. }
  989.  
  990. FUNCTION {year.sort}
  991. { year empty$
  992.     { key empty$
  993.         { "to sort, need year or key in " cite$ * warning$
  994.           ""
  995.         }
  996.         { key sortify }
  997.       if$
  998.     }
  999.     { year sort.format.names }
  1000.   if$
  1001. }
  1002.  
  1003. FUNCTION {author.sort}
  1004. { author empty$
  1005.     { key empty$
  1006.         { "to sort, need author or key in " cite$ * warning$
  1007.           ""
  1008.         }
  1009.         { key sortify }
  1010.       if$
  1011.     }
  1012.     { author sort.format.names }
  1013.   if$
  1014. }
  1015.  
  1016. FUNCTION {author.editor.sort}
  1017. { author empty$
  1018.     { editor empty$
  1019.         { key empty$
  1020.             { "to sort, need author, editor, or key in " cite$ * warning$
  1021.               ""
  1022.             }
  1023.             { key sortify }
  1024.           if$
  1025.         }
  1026.         { editor sort.format.names }
  1027.       if$
  1028.     }
  1029.     { author sort.format.names }
  1030.   if$
  1031. }
  1032.  
  1033. FUNCTION {author.organization.sort}
  1034. { author empty$
  1035.     { organization empty$
  1036.         { key empty$
  1037.             { "to sort, need author, organization, or key in " cite$ * warning$
  1038.               ""
  1039.             }
  1040.             { key sortify }
  1041.           if$
  1042.         }
  1043.         { "The " #4 organization chop.word sortify }
  1044.       if$
  1045.     }
  1046.     { author sort.format.names }
  1047.   if$
  1048. }
  1049.  
  1050. FUNCTION {editor.organization.sort}
  1051. { editor empty$
  1052.     { organization empty$
  1053.         { key empty$
  1054.             { "to sort, need editor, organization, or key in " cite$ * warning$
  1055.               ""
  1056.             }
  1057.             { key sortify }
  1058.           if$
  1059.         }
  1060.         { "The " #4 organization chop.word sortify }
  1061.       if$
  1062.     }
  1063.     { editor sort.format.names }
  1064.   if$
  1065. }
  1066.  
  1067. FUNCTION {presort}
  1068. { type$ "book" =
  1069.   type$ "inbook" =
  1070.   or
  1071.     'author.editor.sort
  1072.     { type$ "proceedings" =
  1073.         'editor.organization.sort
  1074.         { type$ "manual" =
  1075.             'author.organization.sort
  1076.             'year.sort
  1077.           if$
  1078.         }
  1079.       if$
  1080.     }
  1081.   if$
  1082.   "    "
  1083.   *
  1084.   author field.or.null
  1085.   sort.format.names
  1086.   *
  1087.   "    "
  1088.   *
  1089.   title field.or.null
  1090.   sort.format.title
  1091.   *
  1092.   #1 entry.max$ substring$
  1093.   'sort.key$ :=
  1094. }
  1095.  
  1096. ITERATE {presort}
  1097.  
  1098. SORT
  1099.  
  1100. STRINGS { longest.label }
  1101.  
  1102. INTEGERS { number.label longest.label.width }
  1103.  
  1104. FUNCTION {initialize.longest.label}
  1105. { "" 'longest.label :=
  1106.   #1 'number.label :=
  1107.   #0 'longest.label.width :=
  1108. }
  1109.  
  1110. FUNCTION {longest.label.pass}
  1111. { number.label int.to.str$ 'label :=
  1112.   number.label #1 + 'number.label :=
  1113.   label width$ longest.label.width >
  1114.     { label 'longest.label :=
  1115.       label width$ 'longest.label.width :=
  1116.     }
  1117.     'skip$
  1118.   if$
  1119. }
  1120.  
  1121. EXECUTE {initialize.longest.label}
  1122.  
  1123. ITERATE {longest.label.pass}
  1124.  
  1125. FUNCTION {begin.bib}
  1126. { preamble$ empty$
  1127.     'skip$
  1128.     { preamble$ write$ newline$ }
  1129.   if$
  1130.   "\begin{thebibliography}{"  longest.label  * "}" * write$ newline$
  1131. }
  1132.  
  1133. EXECUTE {begin.bib}
  1134.  
  1135. EXECUTE {init.state.consts}
  1136.  
  1137. ITERATE {call.type$}
  1138.  
  1139. FUNCTION {end.bib}
  1140. { newline$
  1141.   "\end{thebibliography}" write$ newline$
  1142. }
  1143.  
  1144. EXECUTE {end.bib}
  1145.